package com.ecoolex.discount.sales.entity;

import com.ecoolex.framework.common.annotation.Description;
import java.util.ArrayList;
import java.util.Arrays;
import org.springframework.lang.NonNull;

/**
 *
 *   折扣产品<br>
 *<br>
 * 数据表： discount_product
 *
 */
@Description({"折扣产品"})
public class DiscountProductWithBLOBs extends DiscountProduct {
    /**
     *
     *   描述    <br>
     *<br>
     * 字段名： discount_product.Describe
     */
    @Description({"描述", "数据长度: 65535"})
    private String describe;

    /**
     *
     *   使用须知    <br>
     *<br>
     * 字段名： discount_product.UseInformation
     */
    @Description({"使用须知", "数据长度: 65535"})
    private String useInformation;

    /**
     *
     *   其他参数    <br>
     *<br>
     * 字段名： discount_product.Parameters
     */
    @Description({"其他参数", "数据长度: 65535"})
    private String parameters;

    /**
     * 获取参数<br><br>
     *
     *   描述    <br>
     *<br>
     * 字段名： discount_product.Describe
     */
    public String getDescribe() {
        return describe;
    }

    /**
     * 设置参数<br><br>
     *
     *   描述<br>
     *<br>
     * 字段名： discount_product.Describe
     */
    public void setDescribe(String describe) {
        this.describe = describe == null ? null : describe.trim();
    }

    /**
     * 获取参数<br><br>
     *
     *   使用须知    <br>
     *<br>
     * 字段名： discount_product.UseInformation
     */
    public String getUseInformation() {
        return useInformation;
    }

    /**
     * 设置参数<br><br>
     *
     *   使用须知<br>
     *<br>
     * 字段名： discount_product.UseInformation
     */
    public void setUseInformation(String useInformation) {
        this.useInformation = useInformation == null ? null : useInformation.trim();
    }

    /**
     * 获取参数<br><br>
     *
     *   其他参数    <br>
     *<br>
     * 字段名： discount_product.Parameters
     */
    public String getParameters() {
        return parameters;
    }

    /**
     * 设置参数<br><br>
     *
     *   其他参数<br>
     *<br>
     * 字段名： discount_product.Parameters
     */
    public void setParameters(String parameters) {
        this.parameters = parameters == null ? null : parameters.trim();
    }

    public enum Column {
        productId("ProductId", "productId", "INTEGER", false),
        brandId("BrandId", "brandId", "INTEGER", false),
        regionType("RegionType", "regionType", "INTEGER", false),
        discountMode("DiscountMode", "discountMode", "INTEGER", false),
        serviceType("ServiceType", "serviceType", "INTEGER", false),
        serviceDataId("ServiceDataId", "serviceDataId", "VARCHAR", false),
        name("Name", "name", "VARCHAR", true),
        subTitle("SubTitle", "subTitle", "VARCHAR", false),
        image("Image", "image", "VARCHAR", false),
        shelfLifeStrategy("ShelfLifeStrategy", "shelfLifeStrategy", "INTEGER", false),
        shelfLifeDescribe("ShelfLifeDescribe", "shelfLifeDescribe", "VARCHAR", false),
        fixedEndShelfLife("FixedEndShelfLife", "fixedEndShelfLife", "TIMESTAMP", false),
        dynamicShelfLifeType("DynamicShelfLifeType", "dynamicShelfLifeType", "INTEGER", false),
        dynamicShelfLifeValue("DynamicShelfLifeValue", "dynamicShelfLifeValue", "INTEGER", false),
        startReleaseDate("StartReleaseDate", "startReleaseDate", "TIMESTAMP", false),
        endReleaseDate("EndReleaseDate", "endReleaseDate", "TIMESTAMP", false),
        startSalesDate("StartSalesDate", "startSalesDate", "TIMESTAMP", false),
        endSalesDate("EndSalesDate", "endSalesDate", "TIMESTAMP", false),
        brandWeight("BrandWeight", "brandWeight", "INTEGER", false),
        isNew("IsNew", "isNew", "BIT", false),
        status("Status", "status", "INTEGER", true),
        availableStatus("AvailableStatus", "availableStatus", "INTEGER", false),
        deleted("Deleted", "deleted", "BIT", false),
        createUser("CreateUser", "createUser", "VARCHAR", true),
        createTime("CreateTime", "createTime", "TIMESTAMP", false),
        updateUser("UpdateUser", "updateUser", "VARCHAR", false),
        updateTime("UpdateTime", "updateTime", "TIMESTAMP", false),
        describe("Describe", "describe", "LONGVARCHAR", true),
        useInformation("UseInformation", "useInformation", "LONGVARCHAR", false),
        parameters("Parameters", "parameters", "LONGVARCHAR", true);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }
    }
}